ARG BASE_OS=registry.openanolis.cn/openanolis/anolisos:23

FROM ${BASE_OS}

ARG GOLANG_VERSION=1.20.12 \
    OS_SUFFIX=23

LABEL org.opencontainers.image.title="Golang" \
      org.opencontainers.image.version="${GOLANG_VERSION}-${OS_SUFFIX}"

ENV GOLANG_VERSION ${GOLANG_VERSION}
ENV GOPATH /go
ENV PATH $GOPATH/bin:$PATH

RUN set -eux; \
    dnf install -y golang-${GOLANG_VERSION}; \
    dnf clean all; \
    mkdir -p "$GOPATH/src" "$GOPATH/bin"; \
    chmod -R 777 "$GOPATH"

WORKDIR $GOPATH
